package cn.bgs.controller;


import cn.bgs.common.R;
import cn.bgs.pojo.Complaints;
import cn.bgs.service.IComplaintsService;
import cn.bgs.service.IComplaintsTypeService;
import cn.bgs.vo.UserFile;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 投诉建议表 前端控制器
 * </p>
 *
 * @author cf
 * @since 2022-06-07
 */
@RestController
@RequestMapping("/complaints")
public class ComplaintsController {

    @Autowired
    private IComplaintsService iComplaintsService;

    @PostMapping("/appComlanints")
    @ApiOperation(value = "app投诉建议")
    public R appComlanints(@RequestBody Complaints complaints){

        System.out.println("++++++"+complaints.toString());


        if (complaints.getComplaintsTypeId()!=null){

            iComplaintsService.appComlanints(complaints);
            return R.ok().message("修改成功");
        }else {
            return R.error().message("修改失败，信息有误或者验证码失效");
        }

    }

    @PostMapping("/appcomplaintinInfoFind")
    @ApiOperation(value = "app投诉列表查询")
    public R appcomplaintinInfoFind(){

           List<Complaints> complaintsList= iComplaintsService.appcomplaintinInfoFind();

            return R.ok().message("查询成功").data("complaintsList",complaintsList);




    }
}
